package cn.usian.pricingstrategy.date.controller;

import cn.usian.basicInformation.log.commons.Constants;
import cn.usian.basicInformation.log.commons.Log;
import cn.usian.pojo.Result;
import cn.usian.pojo.pricingstrategy.date.PricingSpecialDate;
import cn.usian.pricingstrategy.date.service.IDateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/date")
public class DateController {
    @Autowired
    private IDateService dateService;

    @GetMapping("/list/{year}")
    public Result list(@PathVariable String year) {
        return Result.ok(dateService.list(year));
    }

    @PostMapping("/save")
    @Log(operationModule = "定价策略", operationType = Constants.INSERT)
    public Result save(@RequestBody PricingSpecialDate date) {
        dateService.save(date);
        return Result.ok();
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody PricingSpecialDate date) {
        dateService.delete(date);
        return Result.ok();
    }

}
